<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="text" id="getid">
    <button onclick="clickMe()">猜</button>
    <span id="resultId">结果</span><br>
    <output id="test"></output>
    <script>
        var random = parseInt(Math.random() * 100 + 1);
        var testId = document.getElementById("test");
        testId.value = "测试输出:" + random;
        function clickMe(){
            var num = document.getElementById("getid").value;
            var result ;
            if(num > random){
                result = "大了";
            } else if(num < random){
                result = "小了";
            } else {
                result = "恭喜你猜对了";
            }
            var guessObj = document.getElementById("resultId");
            guessObj.innerHTML = result;
        }
    </script>
</body>
</html>